﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace GuidGeneratorWPF
{
	public class Int32ValidationRule : ValidationRule
	{
		public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
		{
			string inputString = (value ?? string.Empty).ToString();

			try
			{
				int intValue = int.Parse(inputString);
			}
			catch (Exception ex)
			{
				return new ValidationResult(false, ex.Message);
			}

			return new ValidationResult(true, null);
		}
	}
}
